﻿using DC2010.Objects;
using DC2010.Objects.Base;
using DC2010.Objects.Data;

namespace DC2010.Effects
{
    public class P_Heal_Effect : EffectLogic
    {
        public P_Heal_Effect(EffectData ed)
            : base(ed)
        {
            ShortName = "HEAL";
            LongName = "Continuosly heal.";
            EffectType = EffectType.Pump;
        }

        public override void Pump(BaseObject aTarget)
        {
            if (CheckPumpCondition(aTarget))
            {
                if (aTarget is CreatureData)
                {
                    CreatureData aCreature = (CreatureData)aTarget;
                    int Amount = Data.Params.Find(A => A.Key == "AMOUNT").Value.ToInt();


                    //heal amount
                    if (aCreature.Attributes.Health.Current + Amount >= aCreature.Attributes.Health.Max) aCreature.Attributes.Health.SetCurrent(aCreature.Attributes.Health.Max);
                    else
                        aCreature.Attributes.Health.Incr(Amount);
                }


            }
        }
    }
}
